import log from "./logger";
import axios from "axios";
// import promailSpawn from "./promailspawn";
import temperatureWorker from "./temperatureworker";
import config from "./config";
import {mqttInit} from "./mqtt_publish"

async function start() {
    axios.defaults.timeout = 15 * 1000
    // 加载配置
    try {
        // await settings.init();
        await config.init();
    } catch (e) {
        throw e;
    }
    // mqtt连接
    mqttInit()
    // 开守护进程
    // promailSpawn.init();
    if (config.type === 'temperature') {
        temperatureWorker.init();
    }
    log.info("启动完成");
}

start()